﻿
'Imports System.IO
'Imports System.IO.File
'Imports System.Xml
'Imports System.Net

'Public Class FrmMachineOld

'    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
'        Try

'            If Button5.Text = "修改" Then
'                '产品信息
'                TextBox_Site.ReadOnly = False
'                TextBox_Dept.ReadOnly = False
'                TextBox_LineID.ReadOnly = False
'                TextBox_MIP.ReadOnly = False
'                TextBox_MModel.ReadOnly = False
'                TextBox_MName.ReadOnly = False
'                TextBox_MNO.ReadOnly = False
'                TextBox_MSN.ReadOnly = False
'                TextBox_Plant.ReadOnly = False
'                '扫码设置
'                TextBox_KeyType.ReadOnly = False
'                TextBox_StageCode.ReadOnly = False
'                '服务器设置
'                TextBox_servIP.ReadOnly = False
'                TextBox_portNO.ReadOnly = False
'                TextBox_FTPIP.ReadOnly = False
'                TextBox_ftpUSER.ReadOnly = False
'                TextBox_ftpPASSWORD.ReadOnly = False
'                TextBox_PICPATH.ReadOnly = False
'                TextBox_PROPATH.ReadOnly = False

'                Button5.Text = "保存"

'            ElseIf Button5.Text = "保存" Then
'                If TextBox_PICPATH.Text = "" Then

'                End If





'                Dim filepath = My.Application.Info.DirectoryPath & "\Tool\"
'                Dim file_num As Integer = FreeFile()
'                FileOpen(file_num, filepath & "MachineInfo.txt", OpenMode.Random)
'                MachineInfo1.Machine_Site = TextBox_Site.Text
'                MachineInfo1.Machine_Dept = TextBox_Dept.Text
'                MachineInfo1.Machine_LineID = TextBox_LineID.Text
'                MachineInfo1.Machine_MIP = TextBox_MIP.Text
'                MachineInfo1.Machine_MModel = TextBox_MModel.Text
'                MachineInfo1.Machine_MName = TextBox_MName.Text
'                MachineInfo1.Machine_MNO = TextBox_MNO.Text
'                MachineInfo1.Machine_MSN = TextBox_MSN.Text
'                MachineInfo1.Machine_Plant = TextBox_Plant.Text
'                MachineInfo1.Machine_KeyType = TextBox_KeyType.Text
'                MachineInfo1.Machine_StageCode = TextBox_StageCode.Text
'                FilePut(file_num, MachineInfo1)
'                FileClose(file_num)

'                TextBox_Site.ReadOnly = True
'                TextBox_Dept.ReadOnly = True
'                TextBox_LineID.ReadOnly = True
'                TextBox_MIP.ReadOnly = True
'                TextBox_MModel.ReadOnly = True
'                TextBox_MName.ReadOnly = True
'                TextBox_MNO.ReadOnly = True
'                TextBox_MSN.ReadOnly = True
'                TextBox_Plant.ReadOnly = True '
'                TextBox_KeyType.ReadOnly = True
'                TextBox_StageCode.ReadOnly = True
'                TextBox_servIP.ReadOnly = True
'                TextBox_portNO.ReadOnly = True
'                TextBox_ftpIP.ReadOnly = True
'                TextBox_ftpUSER.ReadOnly = True
'                TextBox_ftpPASSWORD.ReadOnly = True
'                TextBox_PICPATH.ReadOnly = True
'                TextBox_PROPATH.ReadOnly = True
'                '服务器信息写入XML
'                Dim ipp As IPAddress = IPAddress.Parse(TextBox_servIP.Text)
'                Dim infoSFCS As New XmlTextWriter(Application.StartupPath & "\数据上传程序\INFOSFCS.xml", System.Text.Encoding.GetEncoding("utf-8"))
'                infoSFCS.WriteStartDocument()
'                infoSFCS.Formatting = Formatting.Indented
'                infoSFCS.WriteStartElement("SFCSInfo")
'                infoSFCS.WriteElementString("servIP", TextBox_servIP.Text)
'                infoSFCS.WriteElementString("portNO", TextBox_portNO.Text)
'                infoSFCS.WriteElementString("ftpIP", TextBox_ftpIP.Text)
'                infoSFCS.WriteElementString("ftpUser", TextBox_ftpUSER.Text)
'                infoSFCS.WriteElementString("ftpPassword", TextBox_ftpPASSWORD.Text)
'                infoSFCS.WriteElementString("PICPath", TextBox_PICPATH.Text)
'                infoSFCS.WriteElementString("ProgramPath", TextBox_PROPATH.Text)
'                infoSFCS.WriteEndElement()
'                infoSFCS.Close()
'                '
'                Button5.Text = "修改"
'                MsgBox("保存成功!请重启软件!")
'                MachineInfo_flag = True
'            End If
'        Catch ex As Exception
'            MsgBox("保存失败!" & ex.Message.ToString)
'        End Try
'    End Sub

'    Private Sub FrmMachine_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'        Try
'            Dim filepath = My.Application.Info.DirectoryPath & "\Tool\"
'            Dim xmlpath = My.Application.Info.DirectoryPath & "\数据上传程序\INFOSFCS.xml"
'            Dim file_num As Integer = FreeFile()
'            Dim j As Integer = 0
'            Dim file_exist As Boolean = Exists(filepath & "MachineInfo.txt")
'            Dim XML_exist As Boolean = Exists(xmlpath)
'            If file_exist = True Then
'                FileOpen(file_num, filepath & "MachineInfo.txt", OpenMode.Random)
'                FileGet(file_num, MachineInfo1)
'                FileClose(file_num)
'                TextBox_Site.Text = MachineInfo1.Machine_Site
'                TextBox_Dept.Text = MachineInfo1.Machine_Dept
'                TextBox_LineID.Text = MachineInfo1.Machine_LineID
'                TextBox_MIP.Text = MachineInfo1.Machine_MIP
'                TextBox_MModel.Text = MachineInfo1.Machine_MModel
'                TextBox_MName.Text = MachineInfo1.Machine_MName
'                TextBox_MNO.Text = MachineInfo1.Machine_MNO
'                TextBox_MSN.Text = MachineInfo1.Machine_MSN
'                TextBox_Plant.Text = MachineInfo1.Machine_Plant
'                TextBox_StageCode.Text = MachineInfo1.Machine_StageCode
'                TextBox_KeyType.Text = MachineInfo1.Machine_KeyType

'            Else
'                TextBox_Site.Text = ""
'                TextBox_Dept.Text = ""
'                TextBox_LineID.Text = ""
'                TextBox_MIP.Text = ""
'                TextBox_MModel.Text = ""
'                TextBox_MName.Text = ""
'                TextBox_MNO.Text = ""
'                TextBox_MSN.Text = ""
'                TextBox_Plant.Text = ""
'                TextBox_StageCode.Text = ""
'                TextBox_KeyType.Text = ""
'            End If
'            If XML_exist = True Then
'                Dim reader1 As New Xml.XmlTextReader(xmlpath)
'                reader1.ReadToFollowing("servIP")
'                TextBox_servIP.Text = reader1.ReadString
'                reader1.ReadToFollowing("portNO")
'                TextBox_portNO.Text = reader1.ReadString

'                reader1.ReadToFollowing("ftpIP")
'                TextBox_ftpIP.Text = reader1.ReadString
'                reader1.ReadToFollowing("ftpUser")
'                TextBox_ftpUSER.Text = reader1.ReadString
'                reader1.ReadToFollowing("ftpPassword")
'                TextBox_ftpPASSWORD.Text = reader1.ReadString
'                reader1.ReadToFollowing("PICPath")
'                TextBox_PICPATH.Text = reader1.ReadString
'                reader1.ReadToFollowing("ProgramPath")
'                TextBox_PROPATH.Text = reader1.ReadString
'                reader1.Close()
'            Else
'                TextBox_servIP.Text = ""
'                TextBox_portNO.Text = ""
'                TextBox_ftpIP.Text = ""
'                TextBox_ftpUSER.Text = ""
'                TextBox_ftpPASSWORD.Text = ""
'            End If
'            TextBox_Site.ReadOnly = True
'            TextBox_Dept.ReadOnly = True
'            TextBox_LineID.ReadOnly = True
'            TextBox_MIP.ReadOnly = True
'            TextBox_MModel.ReadOnly = True
'            TextBox_MName.ReadOnly = True
'            TextBox_MNO.ReadOnly = True
'            TextBox_MSN.ReadOnly = True
'            TextBox_Plant.ReadOnly = True
'            TextBox_KeyType.ReadOnly = True
'            TextBox_StageCode.ReadOnly = True
'            TextBox_servIP.ReadOnly = True
'            TextBox_portNO.ReadOnly = True
'            TextBox_ftpIP.ReadOnly = True
'            TextBox_ftpUSER.ReadOnly = True
'            TextBox_ftpPASSWORD.ReadOnly = True
'            Button5.Text = "修改"
'        Catch ex As Exception
'            MsgBox("设备信息文件错误!" & vbCrLf & ex.Message.ToString)
'        End Try

'    End Sub


'    Private Sub TextBox_servIP_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox_servIP.KeyPress

'        If Char.IsDigit(e.KeyChar) OrElse e.KeyChar = Chr(8) OrElse e.KeyChar = "." Then
'            e.Handled = False
'        Else
'            e.Handled = True
'            MsgBox("只能输入数值或 "" .""")
'        End If

'    End Sub
'    Private Sub TextBox_portNO_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox_portNO.KeyPress

'        If Char.IsDigit(e.KeyChar) OrElse e.KeyChar = Chr(8) Then
'            e.Handled = False
'        Else
'            e.Handled = True
'            MsgBox("只能输入数值")
'        End If

'    End Sub

'    Private Sub TextBox_PICPATH_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_PICPATH.KeyPress
'        Try
'            If e.KeyChar = "/" Then
'                e.Handled = True
'                MsgBox("不能输入 "" /""，请使用 "" \""")
'            Else
'                e.Handled = False
'            End If

'        Catch ex As Exception

'        End Try
'    End Sub

'    Private Sub TextBox_PROPATH_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_PROPATH.KeyPress
'        Try
'            If e.KeyChar = "/" Then
'                e.Handled = True
'                MsgBox("不能输入 "" /""，请使用 "" \""")
'            Else
'                e.Handled = False
'            End If

'        Catch ex As Exception

'        End Try
'    End Sub
'    Private Sub FTPPATHCHEKC()
'        Dim S1 As String = TextBox_PICPATH.Text
'        Dim S2 As String = TextBox_PROPATH.Text
'        If S1 = "" Or S2 = "" Then
'            MsgBox("图片路径和程序路径都不能为空！")
'        End If
'        If S1(0) = "/" Or S1(S1.Length - 1) = "" Then
'            MsgBox("图片路径末尾都不能有"" / ""！")
'        End If
'        If S2(0) = "/" Or S2(S2.Length - 1) = "" Then
'            MsgBox("程序路径末尾都不能有"" / ""！")
'        End If

'    End Sub
'End Class